
import api from '../index'
import { axios } from '@/utils/request'
import request from '@/utils/request'
var qs = require('querystring')

/**
 * 获取权限列表
 * @param {*} parameter 
 */
export function roleList (parameter) {
  return axios({
    url: api.roleList,
    method: 'get',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function getMenuTree (parameter) {  
  return axios({
    url: api.menuTree,
    method: 'get',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function getMenuListByPid (parameter) {  
  parameter.pid = parameter.pid || 0
  return axios({
    url: `${api.menuListByPid}/${parameter.pid}`,
    method: 'get',
    params: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}


export function getPermissionById (parameter) {  
  parameter.id = parameter.id || 0
  return axios({
    url: `${api.permission}/${parameter.id}`,
    method: 'get',
    params: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
